/** 
 * Description:首页广告DAO
 * Date:2013-1-31
 * Author:Along	
*/
package com.community.shopping.dao;

import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.community.shopping.domain.IndexAdv;

public class IndexAdvDao extends HibernateDaoSupport{
	private Log log = LogFactory.getLog(IndexAdvDao.class);  
	

	public void save(IndexAdv indexAdv){
		getHibernateTemplate().saveOrUpdate(indexAdv);	
		log.debug("-------保存一行indexAdv-------");
	}

	public void delete(IndexAdv indexAdv){		  
		getHibernateTemplate().delete(indexAdv);
		log.debug("---------删除一行indexAdv-------");
	}

    
	public List<IndexAdv> getIndexAdv() {  		
	 return getHibernateTemplate().find(" from IndexAdv order by sort,id"); 
	 }

	public List<IndexAdv> getIndexAdv(String sql){
		String finalsql="from IndexAdv where "+sql;
		return getHibernateTemplate().find(finalsql);
	}
	
	public IndexAdv getIndexAdv(Integer id){
		return getHibernateTemplate().load(IndexAdv.class, id);
	}
	}
